<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml">
<head th:insert="/admin/common/head::css"></head>
<body>
<div th:insert="/admin/common/header::header" ></div>
<!--  main  -->
<div id = "app">
    <div class="container-fluid">
        <div class="row-fluid" id = "contentall">
            <div th:insert="/admin/common/side::side" ></div>
            <!-- modal -->
            <!-- 模态框（Modal） -->
            <div class="modal fade" tabindex="-1" id="jiuye" role="dialog" aria-labelledby="myModalLabel" style="display:none">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                            <h4 class="modal-title" id="myModalLabel"> 就业去向 </h4>
                        </div>

                        <!-- 就业 -->
                        <table class="table">
                            <thead>
                            <tr>
                                <th>就读学校</th>
                                <th>城市</th>
                                <th>就读学位</th>
                                <th>公司</th>
                                <th>职位</th>
                                <th>薪资</th>
                                <th>就业信息</th>
                                <th>开始时间</th>
                                <th>结束时间</th>
                                <th>是否可见</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr v-for = "jiuye in jiuyelist">
                                <td>{{jiuye.school}}</td>
                                <td>{{jiuye.city}}</td>
                                <td>{{jiuye.xuewei}}</td>
                                <td>{{jiuye.company}}</td>
                                <td>{{jiuye.position}}</td>
                                <td>{{jiuye.salary}}</td>
                                <td>{{jiuye.type == 0?'读研':'就业'}}</td>
                                <td>{{jiuye.begintime}}</td>
                                <td>{{jiuye.endtime}}</td>
                                <td>{{jiuye.flag == 0?'可见':'不可见'}}</td>

                            </tr>
                            </tbody>
                        </table>


                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        </div>
                    </div><!-- /.modal-content -->
                </div><!-- /.modal-dialog -->
            </div>
            <!-- modal -->
            <div class="modal fade" tabindex="-1" id="tongji" role="dialog" aria-labelledby="myModalLabel" style="display:none">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                            <h4 class="modal-title" id="myModalLabel"> 工资统计 </h4>
                        </div>
                        <!-- 就业 -->
                        [[ ${number} ]]


                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        </div>
                    </div><!-- /.modal-content -->
                </div><!-- /.modal-dialog -->
            </div>

            <!-- modal -->
            <!-- 模态框（Modal） -->
            <div class="modal fade" tabindex="-1" id="zhiye" role="dialog" aria-labelledby="zhiyelabel" style="display:none;">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                            <h4 class="modal-title" id="zhiyemodal"> 职业 </h4>
                        </div>

                        <!-- 职业 -->
                        <table class="table">
                            <thead>
                            <tr>
                                <th>就读学校</th>
                                <th>城市</th>
                                <th>就读学位</th>
                                <th>公司</th>
                                <th>职位</th>
                                <th>薪资</th>
                                <th>就业信息</th>
                                <th>开始时间</th>
                                <th>结束时间</th>
                                <th>更新时间</th>
                                <th>是否可见</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr v-for = "zhiye in zhiyelist">
                                <td>{{zhiye.school}}</td>
                                <td>{{zhiye.city}}</td>
                                <td>{{zhiye.xuewei}}</td>
                                <td>{{zhiye.company}}</td>
                                <td>{{zhiye.position}}</td>
                                <td>{{zhiye.salary}}</td>
                                <td>{{zhiye.type == 0?'读研':'就业'}}</td>
                                <td>{{zhiye.begintime}}</td>
                                <td>{{zhiye.endtime}}</td>
                                <td>{{zhiye.date}}</td>
                                <td>{{zhiye.flag == 0?'可见':'不可见'}}</td>

                            </tr>
                            </tbody>
                        </table>

                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        </div>
                    </div><!-- /.modal-content -->
                </div><!-- /.modal-dialog -->
            </div>
            <!-- modal -->

            <!-- content -->
            <div style="display: flex; flex-direction: column">
                <div class="span10" id="content">
                    <div class="row-fluid">
                        <!-- block -->
                        <div class="block">
                            <div class="navbar navbar-inner block-header">
                                <a th:if = "${loginUser.userType == 0}" class="btn btn-default" th:href="@{/admin/user/add.html}" role="button">增加用户</a>
                                <form method="post" th:action="@{/admin/user/page}">
                                    <div>
                                        <label>年级</label><input name="search1"/>
                                    </div>
                                    <div>
                                        <label>专业</label><input name="search2"/>
                                    </div>
                                    <div>
                                        <label>班级</label><input name="search3"/>
                                    </div>
                                    <button type="submit" class="btn btn-primary"  >搜索</button>
                                </form>
                                <button type="button" class="btn btn-default" data-toggle="modal" data-target="#tongji"  role="button">工资统计</button>



                            </div>
                            <div class="block-content collapse in">
                                <div class="span12">
                                    <table class="table">
                                        <thead>
                                        <tr>
                                            <th>序号</th>
                                            <th>用户名</th>
                                            <th>手机号</th>
                                            <th>用户类别</th>
                                            <th>年级</th>
                                            <th>专业</th>
                                            <th>班级</th>
                                            <th>操作</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <tr th:each = "user : ${page.records}">
                                            <td th:text="${user.id}"></td>
                                            <td th:text="${user.username}"></td>
                                            <td th:text="${user.phone}"></td>
                                            <td th:text="${user.userType}==0?'辅导员或院系领导':'高校毕业生'"></td>
                                            <td th:text="${user.grade!=null?user.grade.name:''}"></td>
                                            <td th:text="${user.major!=null?user.major.name:''}"></td>
                                            <td th:text="${user.bj!=null?user.bj.name:''}"></td>
                                            <td>
                                                <!--            //这样可以拿到对应数据-->
                                                <a th:if = "${loginUser.userType == 0}" class="btn btn-default" th:href="@{/admin/user/detail(id = ${user.id})}" role="button">编辑</a>
<!--                                                <a class="btn btn-default" th:href="@{/admin/user/delete(id = ${user.id})}" role="button">删除</a>-->
                                                <button type="button" class="btn btn-default" data-toggle="modal" data-target="#jiuye" th:v-on:click = "'showmessage('+${user.id}+')'" role="button">就业信息</button>
                                                <button type="button" class="btn btn-default" data-toggle="modal" data-target="#zhiye" th:v-on:click = "'showzhiyemessage('+${user.id}+')'" role="button">职业发展</button>

                                            </td>
                                        </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <!-- /block -->
                    </div>
                </div>
                <script>
                var vm = new Vue({
                    el: '#contentall',
                    data: {
                        duyanlist:[],
                        jiuyelist:[],
                        duyan: true,
                        jiuye: true,
                        zhiyelist:[],
                        number: ''
                    },
                    methods:{
                        <!-- 类型 -->
                        showmessage: function (uid) {
                            axios.get("/resource/admin/user/getjiutemessage?type=0&uid="+uid).then(rep=>{
                                var data = rep.data;
                                this.duyanlist = data.data.jiuyeList
                                console.log(this.duyanlist)
                                axios.get("/resource/admin/user/getjiutemessage?type=1&uid="+uid).then(rep=>{
                                    var data = rep.data;
                                    this.jiuyelist = data.data.jiuyeList
                                    console.log(this.jiuyelist)
                                })
                            })
                        },
                        showzhiyemessage: function (uid) {
                            axios.get("/resource/admin/user/getzhiyemessage?uid="+uid).then(rep=>{
                                var data = rep.data
                                this.zhiyelist = data.data.zhiyeList;
                                console.log(this.zhiyelist)
                            })
                        }
                    }
                });
            </script>
            </div>
            <!-- content -->
        </div>
    </div>
</div>
<div th:insert = "/admin/common/page::page"></div>

<!--  main  -->
</body>
<div th:insert="/admin/common/footer::js" ></div>
</html>